/**
 * 配置
 * */
package org.zmhhxl.api.auth;

import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.zmhhxl.api.auth.domain.entity.ThirdPartyUser;
import org.zmhhxl.api.auth.factory.RemoteThirdPartyServiceFallbackFactory;
import org.zmhhxl.common.core.domain.Result;

import java.util.Optional;

@FeignClient(name = "thirdPartyService", url = "http://127.0.0.1:8082",
      contextId = "thirdPartyService", fallbackFactory = RemoteThirdPartyServiceFallbackFactory.class)
public interface RemoteThirdPartyService {

   //@SpringQueryMap  @RequestParam
   @GetMapping("/user/third_party/find_by_thirdparty_id/{domain:.+}/id/{id}")
   Result<Optional<ThirdPartyUser>> findByThirdPartyIdAndThirdPartyDomain(@PathVariable("id") String Id, @PathVariable("domain") String domain);

   @GetMapping("/user/third_party/find_by_id/{id}")
   Result<Optional<ThirdPartyUser>> findById(@PathVariable("id") Long id);

   @GetMapping("/user/third_party/find_user_id_by_id/{id}")
   Result<Optional<Long>> findUserIdById(@PathVariable("id") Long id);

   @PostMapping("/user/third_party/save")
   Result<Optional<ThirdPartyUser>> save(@RequestBody(required = false) ThirdPartyUser thirdPartyUser);

}
